<template>
  <div class="remote-storage views-container">
    <div class="wlm-form">
      <div class="wlm-form-hearder flex-row flex-justify-b">
        <span>上传压缩包</span>
      </div>
      <section>
        <div class="wlm-form-content">
          <el-form
            ref="jsFile"
            size="small"
            label-width="140px"
            class="retail-form"
            label-position="right"
          >
            <el-upload
              class="upload-demo"
              :action="pathUrl"
              :on-preview="handlePreview"
              :on-remove="handleRemove"
              :on-change="handleChange"
              :before-remove="beforeRemove"
              multiple
              :limit="3"
              :on-exceed="handleExceed"
              :file-list="fileList">
              <el-button size="small" type="primary">点击上传</el-button>
              <div slot="tip" style="margin-left:10px;" class="el-upload__tip">只能上传shop.zip,h5.zip,h6.zip这三类型文件</div>
            </el-upload>
          </el-form>
        </div>
      </section>
    </div>

  </div>

</template>
<script>

export default {
  data() {
    return {
      fileList: [],
      list: []
    }
  },
  computed: {
    pathUrl() {
      return `${location.protocol}//${location.hostname}/${location.href.includes('addons/weliam_areashop') ? 'addons/weliam_areashop/' : ''}/web/index.php?s=uploadH5_H6_Pc`
      // return `https://devwe7.weliam.cn/addons/weliam_areashop/web/index.php?s=uploadH5_H6_Pc`
    }
  },
  created() {
    console.log(window.location, 'this.window.location.host')
  },
  methods: {
    handleChange(file, fileList) {
      console.log('----------------------------------', file, fileList)
    },
    handleRemove(file, fileList) {
      console.log(file, fileList)
    },
    handlePreview(file) {
      console.log(file)
    },
    handleExceed(files, fileList) {
      this.$message.warning(`当前限制选择 3 个文件，本次选择了 ${files.length} 个文件，共选择了 ${files.length + fileList.length} 个文件`)
    },
    beforeRemove(file, fileList) {
      return this.$confirm(`确定移除 ${file.name}？`)
    }
  }
  // formFormatSubmits() {
  //     let fd = new FormData()
  //     fd.append('files',this.list)

  //   uploadH5_H6_Pc(fd).then(res => {
  //     console.log(res, 'resssssssssssssssssssssssssss')
  //   })
  // },

  // handleRemove(file, fileList) {
  //   // console.log(fileList.name,'11111111111111');
  // },
  // handlePreview(file) {
  //   console.log(file, 'dddddddddddd');

  // },
  // handlechange(file,fileList) {
  //   // console.log(file,'dddssssssssss');
  // //  this.list = file.raw
  // console.log(11111111111111111111111111111,fileList);
  //   this.list.push(file.raw)
  // },

  // }

}
</script>
<style lang="scss" scope>

</style>
